package com.sscaipiao.android.model;

import java.util.Date;

import com.sscaipiao.android.R;
import com.sscaipiao.android.common.Constants;
import com.sscaipiao.android.utils.StringUtil;

public class Lottery {
	
	private String type;
	private String code;
	private int icon;
	private String name;
	private long periodNo;
	private Date dLineTime;
	private long betCount;
	private long currPool;
	
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
		if(StringUtil.isNotEmptyString(type)) {
			for (LotteryEntry entry : Constants.LOTT_ARRAY) {
				if (entry.getType().equals(type)) {
					code = entry.getCode();
					name = entry.getName();
					icon = entry.getPicID();
				}
			}

		}
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
		if(StringUtil.isNotEmptyString(code)){
			for (LotteryEntry entry : Constants.LOTT_ARRAY) {
				if (entry.getCode().equals(code)) {
					type = entry.getType();
					name = entry.getName();
					icon = entry.getPicID();
				}
			}
		}
	}

	/**
	 * {"lotteryList":[{"name":"双色球","code":"ssq","type":1},{"code":"七乐彩","type":307},
	 * {"name":"东方6+1","code":"601","type":7},{"name":"让球胜平负","code":"bd1","type":112},
	 * {"name":"足球单场","code":"bd6","type":117},{"name":"11选5","code":"D11","type":106},
	 * {"name":"安徽快3","code":"zch010","type":201},{"code":"15选5","type":155},
	 * {"name":"超级大乐透","code":"dlt","type":107},{"name":"七乐彩","code":"307","type":5},
	 * {"name":"胜负彩","code":"sfc","type":108},{"name":"比分","code":"bd4","type":115},
	 * {"name":"排列3","code":"p3","type":101},{"name":"15选5","code":"155","type":6},{"name":"3D","code":"3d","type":3},
	 * {"name":"4D","code":"4d","type":4},{"name":"六场半全场","code":"bqc","type":109},{"name":"半全场","code":"bd5","type":116},
	 * {"code":"东方6+1","type":601},{"name":"7星彩","code":"p7","type":103},{"name":"时时彩","code":"ssc","type":50},
	 * {"name":"总进球数","code":"bd2","type":113},{"name":"时时乐","code":"ssl","type":2},
	 * {"name":"四场进球","code":"4jq","type":110},{"name":"上下单双","code":"bd3","type":114},
	 * {"name":"排列5","code":"p5","type":102}],"strMessage":"获取彩种成功","token":"xx","status":"01"}
	 * 
	 * 
	 * **/
	public int getIcon() {
		return icon;
	}
	public void setIcon(int icon) {
		this.icon = icon;
	}
	public long getPeriodNo() {
		return periodNo;
	}
	public void setPeriodNo(long periodNo) {
		this.periodNo = periodNo;
	}
	public Date getdLineTime() {
		return dLineTime;
	}
	public void setdLineTime(Date dLineTime) {
		this.dLineTime = dLineTime;
	}
	public long getBetCount() {
		return betCount;
	}
	public void setBetCount(long betCount) {
		this.betCount = betCount;
	}
	public long getCurrPool() {
		return currPool;
	}
	public void setCurrPool(long currPool) {
		this.currPool = currPool;
	}

	public Class getActivity() {
		if (StringUtil.isNotEmptyString(code)) {
			for (LotteryEntry entry : Constants.LOTT_ARRAY) {
				if (entry.getCode().equals(code)) {
					return entry.getActivity();
				}
			}
		}
		if (StringUtil.isNotEmptyString(name)) {
			for (LotteryEntry entry : Constants.LOTT_ARRAY) {
				if (entry.getName().equals(name)) {
					return entry.getActivity();
				}
			}
		}
		if (StringUtil.isNotEmptyString(type)) {
			for (LotteryEntry entry : Constants.LOTT_ARRAY) {
				if (entry.getType().equals(type)) {
					return entry.getActivity();
				}
			}
		}
		return null;
	}
	public Class getHisActivity() {
		if (StringUtil.isNotEmptyString(code)) {
			for (LotteryEntry entry : Constants.LOTT_ARRAY) {
				if (entry.getCode().equals(code)) {
					return entry.getHisActivity();
				}
			}
		}
		if (StringUtil.isNotEmptyString(name)) {
			for (LotteryEntry entry : Constants.LOTT_ARRAY) {
				if (entry.getName().equals(name)) {
					return entry.getHisActivity();
				}
			}
		}
		if (StringUtil.isNotEmptyString(type)) {
			for (LotteryEntry entry : Constants.LOTT_ARRAY) {
				if (entry.getType().equals(type)) {
					return entry.getHisActivity();
				}
			}
		}
		return null;
	}
	public Class getPayActivity() {
		if (StringUtil.isNotEmptyString(code)) {
			for (LotteryEntry entry : Constants.LOTT_ARRAY) {
				if (entry.getCode().equals(code)) {
					return entry.getPayActivity();
				}
			}
		}
		if (StringUtil.isNotEmptyString(name)) {
			for (LotteryEntry entry : Constants.LOTT_ARRAY) {
				if (entry.getName().equals(name)) {
					return entry.getPayActivity();
				}
			}
		}
		if (StringUtil.isNotEmptyString(type)) {
			for (LotteryEntry entry : Constants.LOTT_ARRAY) {
				if (entry.getType().equals(type)) {
					return entry.getPayActivity();
				}
			}
		}
		return null;
	}

	
	

}
